package com.ft.scan.common;

import java.util.HashMap;
import java.util.Map;

//这里用来放text in的所有接口路径
public class ApiUrls {
    private static final Map<String, String> apiUrls = new HashMap<>();

    static {
        // 图片转换word
        apiUrls.put("PHOTO_TO_WORD", "https://api.textin.com/robot/v1.0/api/doc_restore");
        // 图片转换excel
        apiUrls.put("PHOTO_TO_EXCEL", "https://api.textin.com/ai/service/v2/recognize/table?excel=1");
        // 证件分类
        apiUrls.put("CERT_CLASS", "https://api.textin.com/robot/v1.0/api/cert_classify");
        // 信息提取
        apiUrls.put("NLP", "https://api.textin.com/ai/service/v1/contents-extract");
        // pdf转word
        apiUrls.put("PDF_TO_WORD", "https://api.textin.com/ai/service/v1/file-convert/pdf-to-word");
        // pdf转excel
        apiUrls.put("PDF_TO_EXCEL", "https://api.textin.com/ai/service/v1/file-convert/pdf-to-excel");
        // pdf转ppt
        apiUrls.put("PDF_TO_PPT", "https://api.textin.com/ai/service/v1/file-convert/pdf-to-ppt");
        // pdf转jpg
        apiUrls.put("PDF_TO_JPG", "https://api.textin.com/ai/service/v1/file-convert/pdf-to-image");
        // word转pdf
        apiUrls.put("WORD_TO_PDF", "https://api.textin.com/ai/service/v1/file-convert/word-to-pdf");
        // excel转pdf
        apiUrls.put("EXCEL_TO_PDF", "https://api.textin.com/ai/service/v1/file-convert/excel-to-pdf");
        // photo转pdf
        apiUrls.put("PHOTO_TO_PDF", "https://api.textin.com/ai/service/v1/file-convert/image-to-pdf");
        // word转image
        apiUrls.put("WORD_TO_IMAGE", "https://api.textin.com/ai/service/v1/file-convert/word-to-image");
    }

    public static String getUrlByApiName(String apiName) {
        return apiUrls.get(apiName);
    }

    public static String getApiUrlByType(String type) {
        String baseUrl = "https://api.textin.com/robot/v1.0/api/";
        switch (type) {
            case "id_card": {
                return baseUrl + "id_card";
            }
            case "family_register": {
                return baseUrl + "household_register";
            }
            case "marriage_certificate": {
                return baseUrl + type;
            }
            case "drive_license": {
                return baseUrl + "driver_license";
            }
        }
        return null;
    }

}

